home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / inet / internet-drafts / draft-ietf-dns-common-errors-00.txt < prev    next >
Text File  |  1993-07-08  |  19KB  |  483 lines

  1. INTERNET DRAFT                        Anant Kumar
  2. Expiration Date: January 6, 1994            Jon Postel
  3.                             Cliff Neuman
  4.                             USC/ISI
  5.  
  6.                             Peter Danzig
  7.                             Steve Miller
  8.                             USC
  9.                             July 1993
  10.  
  11.         Common DNS Errors and Suggested Fixes
  12.  
  13. Status of this Memo
  14.  
  15. This document is an Internet-Draft.  Internet-Drafts are working
  16. documents of the Internet Engineering Task Force (IETF), its
  17. Areas, and its Working Groups.  Note that other groups may also
  18. distribute working documents as Internet-Drafts. Internet-Drafts
  19. are draft documents valid for a maximum of six months.
  20. Internet-Drafts may be updated, replaced, or obsoleted by other
  21. documents at any time.  It is not appropriate to use
  22. Internet-Drafts as reference material or to cite them other than
  23. as a ``working draft'' or ``work in progress.''
  24.  
  25. To learn the current status of any Internet-Draft, please check
  26. the 1id-abstracts.txt listing contained in the Internet-Drafts
  27. Shadow Directories on ds.internic.net, nic.nordu.net,
  28. ftp.nisc.sri.com, or munnari.oz.au.
  29.  
  30. This Internet Draft expires January 6, 1994.
  31.  
  32. Abstract
  33.  
  34. This memo describes common errors seen in DNS implementations and
  35. suggests some fixes. Where applicable, violations of recommendations
  36. from RFC 1034 and RFC 1035 are mentioned. The memo also describes,
  37. where relevant, the algorithms followed in BIND (versions 4.8.3 and
  38. 4.9 which the authors referred to) to serve as an example.
  39.  
  40. Introduction
  41.  
  42. The last few years have seen, virtually, an explosion of DNS traffic
  43. on the NSFnet backbone. Various DNS implementations and various
  44. versions of these implementations interact with each other, producing
  45. huge amounts of unnecessary traffic. Attempts are being made by
  46. researchers all over the internet, to document the nature of these
  47. interactions, the symptomatic traffic patterns and to devise remedies
  48. for the sick pieces of software.
  49.  
  50. This draft is an attempt to document fixes for known DNS problems so
  51. people know what problems to watch out for and how to repair broken
  52. software.
  53.  
  54.                                  [Page 1]
  55.  
  56. USC/ISI                     Kumar, Postel, Neuman
  57.                         Danzig, Miller
  58.  
  59. 1. Fast Retransmissions.
  60.  
  61. DNS implements the classic request-response scheme of client-server
  62. interaction. UDP is, therefore, the chosen protocol for communication
  63. though TCP is used for zone transfers. The onus of requerying in case
  64. no response is seen in a "reasonable" period of time, lies with the
  65. client. Although RFC 1034 and 1035 do not recommend any retransmission
  66. policy, RFC1035 does recommend that the resolvers should cycle through
  67. a list of servers. Both name servers and stub resolvers should,
  68. therefore, implement some kind of a retransmission policy based on
  69. round trip time estimates of the name servers. The client should
  70. back-off exponentially, probably to a maximum timeout value.
  71.  
  72. However, clients might not implement either of the two. They might
  73. not wait a sufficient amount of time before retransmitting or they
  74. might not back-off their inter-query times sufficiently.
  75.  
  76. Thus, what the server would see will be a series of queries from the
  77. same querying entity, spaced very close together. Of course, a
  78. correctly implemented server discards all duplicate queries but the
  79. queries contribute to wide-area traffic, nevertheless.
  80.  
  81. We classify a retransmission of a query as a pure Fast retry timeout
  82. problem when a series of query packets meet the following conditions.
  83.  
  84.  a. Query packets are seen within a time less than a "reasonable
  85.     waiting period" of each other.
  86.  b. No response to the original query was seen i.e. we see two or
  87.     more queries, back to back.
  88.  c. The query packets share the same query identifier.
  89.  d. The server eventually reponds to the query.
  90.  
  91. A GOOD IMPLEMENTATION:
  92.  
  93. BIND (we looked at versions 4.8.3 and 4.9) implements a good
  94. retransmission algorithm which solves or limits all of these problems.
  95. The Berkeley resolver queries servers at an interval that starts at
  96. the greater of 4 seconds and 5 seconds divided by the number of
  97. servers the resolver queries. The resolver cycles through servers and
  98. at the end of a cycle, backs off the time out exponentially.
  99.  
  100. The Berkeley name-server starts with a time-out equal to the greater
  101. of 4 seconds and two times the round-trip time estimate of the server.
  102. The time-out is backed off with each cycle, exponentially, to a
  103. ceiling value of 45 seconds.
  104.  
  105.                                  [Page 2]
  106.  
  107. USC/ISI                        Kumar, Postel, Neuman
  108.                         Danzig, Miller
  109.  
  110. FIXES:
  111.  
  112.   a. Estimate round-trip times or set a reasonably high initial
  113.      time-out.
  114.  
  115.   b. Back-off timeout periods exponentially.
  116.  
  117.   c. Yet another fundamental though difficult fix is to send the client
  118.      an acknowledgement of a query, with a round-trip time estimate.
  119.  
  120. Since UDP is used, no response is expected by the client until the
  121. query is complete.  Thus, it is less likely to have information about
  122. previous packets on which to estimate its back-off time.  Unless, you
  123. maintain state across queries, so subsequent queries to the same
  124. server use information from previous queries.  Unfortunately, such
  125. estimates are likely to be inaccurate for chained requests since the
  126. variance is likely to be high.
  127.  
  128. The fix chosen in the ARDP library used by Prospero is that the
  129. server will send an initial acknowledgement to the client in those
  130. cases where the server expects the query to take a long time (as might
  131. be the case for chained queries).  This initial acknowledgement can
  132. include an expected time to wait before retrying.
  133.  
  134. This fix is more difficult since it requires that the client software
  135. also be trained to expect the acknowledgement packet. This, in an
  136. internet of millions of hosts is at best a hard problem.
  137.  
  138. 2. Recursion Bugs
  139.  
  140. When a server receives a client request, it first looks up its zone
  141. data and the cache to check if the query can be answered. If the
  142. answer is unavailable in either place, the server seeks names of
  143. servers that are more likely to have the information, in its cache or
  144. zone data. It then does one of two things. If the client desires the
  145. server to recurse and the server architecture allows recursion, the
  146. server chains this request to these known servers closest to the
  147. queried name. If the client doesn't seek recursion or if the server
  148. cannot handle recursion, it returns the list of name servers to the
  149. client assuming the client knows what to do with these records.
  150.  
  151. The client queries this new list of name servers to get either the
  152. answer, or names of another set of name servers to query. This process
  153. repeats until the client is satisfied. Servers might also go through
  154. this chaining process if the server returns a CNAME record for the
  155. queried name. Some servers reprocess this name to try and get the
  156. desired record type.
  157.      
  158.                                  [Page 3]
  159.  
  160. USC/ISI                        Kumar, Postel, Neuman
  161.                         Danzig, Miller
  162.  
  163.  
  164. However, in certain cases, this chain of events may not be good. For
  165. example, a broken or malicious name server might list itself as one of
  166. the name servers to query again. The unsuspecting client resends the
  167. same query to the same server.
  168.  
  169. In another situation, more difficult to detect, a set of servers
  170. might form a loop wherein A refers to B and B refers to A. This loop
  171. might involve more than two servers.
  172.  
  173. Yet another error is where the client does not know how to process
  174. the list of name servers returned, and requeries the same server since
  175. that is one (of the few) servers it knows.
  176.  
  177. We, therefore, classify recursion bugs into three distinct categories:
  178.  
  179.  a. Ignored referral: Client did not know how to handle NS records in
  180.     the AUTHORITY section.
  181.  
  182.  b. Too many referrals: Client called on a server too many times,
  183.     beyond a "reasonable" number, with same query. This is different
  184.     from a Fast retransmission problem and a Server Failure
  185.     detection problem in that a response is seen for every query.
  186.     Also, the identifiers are always different. It implies client is
  187.     in a loop and should have detected that and broken it. (RFC 1035
  188.     mentions that client should not recurse beyond a certain depth)
  189.  
  190.  c. Malicious Server: a server refers to itself in the authority
  191.     section. If a server does not have an answer now, it is very
  192.     unlikely it will be any better the next time you query it,
  193.     specially when it claims to be authoritative over a domain.
  194.  
  195.  RFC 1034 warns against such situations, on page 35.
  196.  
  197.  "Bound the amount of work (packets sent, parallel processes
  198.   started) so that a request can't get into an infinite loop or
  199.   start off a chain reaction of requests or queries with other
  200.   implementations EVEN IF SOMEONE HAS INCORRECTLY CONFIGURED
  201.   SOME DATA."
  202.  
  203. A GOOD IMPLEMENTATION:
  204.  
  205. BIND fixes at least one of these problems. It places an upper limit
  206. on the number of recursive queries it will make, to answer a question.
  207. It chases a maximum of 20 referral links and 8 canonical name
  208. translations.
  209.  
  210.                                  [Page 4]
  211.  
  212. USC/ISI                      Kumar, Postel, Neuman
  213.                          Danzig, Miller
  214.  
  215.  
  216.   FIXES:
  217.  
  218.  a. Set an upper limit on the number of referral links and CNAME links
  219.     you are willing to chase.
  220.  
  221.     Note that this is not guaranteed to break only recursion loops. It
  222.     could, in a rare case, prune off a very long search path,
  223.     prematurely.  We know, however, with high probability, that if
  224.     the number of links cross a certain metric (two times the depth
  225.     of the DNS tree), it is a recursion problem.
  226.  
  227.  b. Watch out for self-referring servers. Avoid them whenever
  228.     possible.
  229.  
  230.  c. Make sure you never pass off an authority NS record with your own
  231.     name on it!
  232.  
  233.  d. Fix clients to accept iterative answers from servers not built to
  234.     provide recursion. Such clients should either be happy with the
  235.     non-authoritative answer or be willing to chase the referral links
  236.     themselves.
  237.  
  238. 3. Zero Answer Bugs:
  239.  
  240. Name servers sometimes return an authoritative NOERROR with no
  241. ANSWER, AUTHORITY or ADDITIONAL records. This happens when the queried
  242. name is valid but it does not have a record of the desired type. Of
  243. course, the server has authority over the domain.
  244.  
  245. However, once again, some implementations of resolvers do not
  246. interpret this kind of a response reasonably. They always expect an
  247. answer record when they see an authoritative NOERROR. These entities
  248. continue to resend their queries, possibly endlessly.
  249.  
  250. A GOOD IMPLEMENTATION.
  251.  
  252. BIND resolver code does not query a server more than 3 times. If it
  253. is unable to get an answer from 4 servers, querying them three times
  254. each, it returns error.
  255.  
  256. Of course, it treats a zero-answer response the way it should be
  257. treated; with respect!
  258.  
  259. FIXES:
  260.  
  261.  a. Set an upper limit on the number of retransmissions for a given
  262.     query, at the very least.
  263.  
  264.                                  [Page 5]
  265.  
  266. USC/ISI                      Kumar, Postel, Neuman
  267.                          Danzig, Miller
  268.  
  269.  
  270.  b. Fix resolvers to interpret such a response as an authoritative
  271.     statement of non-existence of the record type for the given name.
  272.  
  273. 4. Inability to detect server failure:
  274.  
  275. Servers in the internet are not very reliable (they go down every
  276. once in a while) and resolvers are expected to adapt to the changed
  277. scenario by not querying the server for a while. Thus, when a server
  278. does not respond to a query, resolvers should try another server.
  279. Also, non-stub resolvers should update their round trip time estimate
  280. for the server to a large value so that server is not tried again
  281. before other, faster servers.
  282.  
  283. Stub resolvers, however, cycle through a fixed set of servers and if,
  284. unfortunately, a server is down while others do not respond for other
  285. reasons (high load, recursive resolution of query is taking more time
  286. than the resolver's time-out, ....), the resolver queries the dead
  287. server again! In fact, some resolvers might not set an upper limit on
  288. the number of query retransmissions they will send and continue to
  289. query dead servers indefinitely.
  290.  
  291. Name servers running system or chained queries might also suffer from
  292. the same problem. They store names of servers they should query for a
  293. given domain. They cycle through these names and in case none of them
  294. answers, hit each one more than one. It is, once again, important that
  295. there be an upper limit on the number of retransmissions, to prevent
  296. network overload.
  297.  
  298. This behavior is clearly in violation of the dictum in RFC1035 (p 46)
  299.  
  300.  "If a resolver gets a server error or other bizarre response
  301.   from a name server, it should remove it from SLIST, and may
  302.   wish to schedule an immediate transmission to the next
  303.   candidate server address."
  304.  
  305. Removal from SLIST implies that the server is not queried again for 
  306. some time.
  307.  
  308. Correctly implemented name servers should, as pointed out before,
  309. update round trip time values for servers that do not respond and
  310. query them only after other, good servers. Servers might, however, not
  311. follow any of these common sense directives. They query dead servers,
  312. and they query them endlessly.
  313.  
  314.                                  [Page 6]
  315.  
  316. USC/ISI                      Kumar, Postel, Neuman
  317.                          Danzig, Miller
  318.  
  319.  
  320. A GOOD IMPLEMENTATION:
  321.  
  322. BIND places an upper limit on the number of times it queries a
  323. server. Both the resolver and the name server code do this. Also,
  324. since the server estimates round-trip times and sorts name server
  325. addresses by these estimates, it does not query a dead server again,
  326. until and unless all the other servers in the list are dead too!
  327. Further, BIND implements exponential back-off too.
  328.  
  329. FIXES:
  330.  
  331.  a. Set an upper limit on number of retransmissions.
  332.  
  333.  b. Measure round-trip time from servers (some estimate is better than
  334.     none). Treat no response as a "very large" round-trip time.
  335.  
  336.  c. Maintain a weighted rtt estimate and decay the "large" value
  337.     slowly, with time, so that the server is eventually tested again,
  338.     but not after an indefinitely long period.
  339.  
  340.  d. Follow an exponential back-off scheme so that even if you do not
  341.     restrict the number of queries, you do not overload the net
  342.     excessively.
  343.  
  344. 5. Cache Leaks:
  345.  
  346. Every resource record returned by a server is cached for TTL seconds,
  347. where the TTL value is returned with the RR. Servers (not
  348. stub-resolvers) cache the RR and answer any queries based on this
  349. cached information, in the future, until the TTL expires. After that,
  350. one more query to the wide-area network gets the RR in cache again.
  351.  
  352. Servers might not implement this caching mechanism well. They might
  353. impose a limit on the cache size or might not interpret the TTL value
  354. correctly. In either case, queries repeated within a TTL period of a
  355. RR constitute a cache leak.
  356.  
  357. A GOOD/BAD IMPLEMENTATION:
  358.  
  359. BIND has no restriction on the cache size and the size is governed by
  360. the limits on the virtual address space of the machine it is running
  361. on. BIND caches RRs for the duration of the TTL returned with each
  362. record.
  363.  
  364. It does, however, not follow the RFCs with respect to interpretation
  365. of a 0 TTL value. If a record has a TTL value of 0 seconds, BIND uses
  366. the minimum TTL value, for that zone, from the SOA record and caches
  367. it for that duration. This, though it saves some traffic on the
  368. wide-area network, is not correct behavior.
  369.  
  370.                                  [Page 7]
  371.  
  372. USC/ISI                      Kumar, Postel, Neuman
  373.                          Danzig, Miller
  374.  
  375.  
  376. FIXES:
  377.  
  378.  a. Look over your caching mechanism to ensure TTLs are interpreted
  379.     correctly.
  380.  
  381.  b. Do not restrict cache sizes (come on, memory is cheap!). Expired
  382.     entries are reclaimed periodically, anyway. Of course, the cache
  383.     size is bound to have some physical limit. But, when possible,
  384.     this limit should be large (run your name server on a machine
  385.     with large amount of physical memory).
  386.  
  387.  c. Possibly, a mechanism is needed to flush the cache, when it is
  388.     known that the information has changed.
  389.  
  390. 6. Name Error Bugs:
  391.  
  392. This bug is very similar to the Zero Answer bug. A server returns an
  393. authoritative NXDOMAIN when the queried name is known to be bad,
  394. obviously by the server authoritative for the domain. This
  395. authoritative NXDOMAIN response is usually accompanied by the SOA
  396. record for the domain, in the authority section.
  397.  
  398. Resolvers should recognize that the name they queried for was a bad
  399. name and should stop querying further.
  400.  
  401. Some resolvers might, however, not interpret this correctly and
  402. continue to query servers, expecting an answer record.
  403.  
  404. GOOD IMPLEMENTATIONS:
  405.  
  406. Some local versions of BIND already implement negative caching. They
  407. typically cache negative answers with a very small TTL, sufficient to
  408. answer a burst of queries spaced close together, as is typically seen.
  409.  
  410. The next official public release of BIND (4.9.2) will most probably
  411. have negative caching as an ifdef'd feature.
  412.  
  413. FIXES:
  414.  
  415.  a. Fix the resolver code.
  416.  
  417.  b. Negative Caching. Negative caching servers will restrict the
  418.     traffic seen on the wide-area network, even if not curb it altogether.
  419.  
  420. Associated with the name error bug is another problem where a server
  421. might return an authoritative NXDOMAIN, although the name is valid. A
  422. secondary server, on start-up, reads the zone information from the
  423.  
  424.                                  [Page 8]
  425.  
  426. USC/ISI                      Kumar, Postel, Neuman
  427.                          Danzig, Miller
  428.  
  429. primary, through a zone transfer. While it is in the process of
  430. loading the zones, it does not have information about them, although
  431. it is authoritative for them.  Thus, any query for a name in that
  432. domain is answered with an NXDOMAIN response code. This problem might
  433. not be disastrous were it not for negative caching servers that cache
  434. this answer and so propagate incorrect information over the internet.
  435.  
  436. BAD IMPLEMENTATION:
  437.  
  438.  BIND apparently suffers from this problem.
  439.  
  440. FIX:
  441.  
  442.  a. Servers should start answering only after loading all the zone
  443.     data. A failed server is better than a server handing out
  444.     incorrect information.
  445.  
  446.  b. Negative cache records for a very small time, sufficient only to
  447.     ward off a burst of requests for the same bad name.
  448.  
  449. 7. Format Errors:
  450.  
  451. Some resolvers issue query packets that do not necessarily conform to
  452. standards as laid out in the relevant rfcs. This unnecessarily
  453. increases net traffic and wastes server time.
  454.  
  455. FIXES:
  456.  
  457.  a. Fix resolvers.
  458.  
  459.  b. Each resolver verify format of packets before sending them out,
  460.     using a mechanism outside of the resolver. This is, obviously,
  461.     needed only if step 1 cannot be followed.
  462.  
  463.  
  464. Authors' Addresses:
  465.  
  466. Anant Kumar, Jon Postel, Cliff Neuman    Peter Danzig, Steve Miller
  467. <anant, postel, bcn>             <danzig, smiller>        
  468.  @isi.edu                     @caldera.usc.edu 
  469.  
  470. USC Information Sciences Institute       Computer Science Department
  471. 4676 Admiralty Way                 Univ. of Southern California
  472. Marina Del Rey CA 90292-6695         University Park
  473.                      Los Angeles CA 90089
  474. Phone:(310) 822-1511
  475. FAX:  (310) 823-6714
  476.  
  477.  
  478. This Internet Draft expires January 6, 1994. 
  479.  
  480.  
  481.                                  [Page 9]
  482.  
  483.